package com.project.webapp.action.backend;

import java.util.List;

import com.project.dao.bean.BackendUser;
import com.project.service.backend.ILoginBackendService;
import com.project.webapp.action.BaseAction;
import com.project.webapp.form.backend.LoginBackendForm;

public class LoginBackendAction extends BaseAction {

	/**
	 * <pre>
	 * 
	 * </pre>
	 */
	private static final long serialVersionUID = 1L;
	private LoginBackendForm loginBackendForm;
	private String result;
	private List<BackendUser> backendUserList;
	private String showList;

	public LoginBackendAction() {
		if (loginBackendForm == null) {
			loginBackendForm = new LoginBackendForm();
		}
	}

	ILoginBackendService loginBackendService;

	public String login() {
		try {
			log.info("login...");
			boolean flag = loginBackendService
					.validLoginBackendUser(loginBackendForm);
			if (flag) {
				result = "登录成功";
			} else {
				result = "登录失败";
				
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		return SUCCESS;
	}

	public String queryBackendUser() {
		try {
			showList = "Yes";
			backendUserList = loginBackendService
					.getBackendUserList(loginBackendForm);
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return SUCCESS;
	}

	public LoginBackendForm getLoginBackendForm() {
		return loginBackendForm;
	}

	public void setLoginBackendForm(LoginBackendForm loginBackendForm) {
		this.loginBackendForm = loginBackendForm;
	}

	public ILoginBackendService getLoginBackendService() {
		return loginBackendService;
	}

	public void setLoginBackendService(ILoginBackendService loginBackendService) {
		this.loginBackendService = loginBackendService;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public List<BackendUser> getBackendUserList() {
		return backendUserList;
	}

	public void setBackendUserList(List<BackendUser> backendUserList) {
		this.backendUserList = backendUserList;
	}

	public String getShowList() {
		return showList;
	}

	public void setShowList(String showList) {
		this.showList = showList;
	}
}
